<template>
  <div>
    <div class="order-wrap">
      <div class="order-card" v-for="(item, i) in completed" :key="i">
        <div>
          <div class="weui-cell-header justify">
            <div class="cell-tt">订单号：{{ item.ordercode }}</div>
            <div class="cell-status ing" v-if="item.ddstatus == '1'">
              未完成
            </div>
            <div class="cell-status over" v-else-if="item.ddstatus == '3'">
              已评价
            </div>
            <div class="cell-status ing" v-else-if="item.ddstatus == '4'">
              旷课未完成
            </div>
            <div class="cell-status over" v-else-if="item.ddstatus == '5'">
              旷课已完成
            </div>
            <div class="cell-status over" v-else>已完成</div>
          </div>
          <div class="weui-cells">
            <div class="van-cell">
              <!-- <div class="card-pic">
                <img :src="item.img" />
              </div>-->
              <div class="weui-cell__bd">
                <div class="ht-justify">
                  <div>
                    <div class="list-tt">类型：{{ item.orderstatus }}</div>
                  </div>
                  <div class="justify-div">
                    <!-- 课时数量 -->
                    <div class=" justify" v-if="item.orderstatus == '学时扣减'">
                      <p>课时数量：</p>
                      <div>{{ item.quantity }}</div>
                    </div>
                    <!-- 单价 -->
                    <div class="justify " v-if="item.orderstatus == '学时扣减'">
                      <p>单价：</p>
                      <div>{{ item.price }}</div>
                    </div>
                    <!-- 金额 -->
                    <div class="justify">
                      <p>金额：</p>
                      <div>
                        <span
                          v-if="
                            item.orderstatus == '学费' ||
                              item.orderstatus == '充值'
                          "
                          >+</span
                        >
                        <span v-else-if="item.jxsh == '8'">+</span>
                        <span v-else>-</span>{{ item.money }}
                      </div>
                    </div>
                  </div>
                  <!-- <div class="list-foot justify">
                    <span class="normal-price">
                      价格：
                      <span
                        v-if="
                          item.orderstatus == '学费' ||
                            item.orderstatus == '充值' ||
                            item.orderstatus == '提现'
                        "
                        >+</span
                      >
                      <span v-else-if="item.jxsh == '8'">+</span>
                      <span v-else>-</span>
                      <span
                        v-if="
                          item.orderstatus == '学费' ||
                            item.orderstatus == '充值'
                        "
                        >{{ item.money }}</span
                      >
                      <span v-else
                        >{{ item.quantity }}x{{ item.money / item.quantity }}
                      </span>
                      <i>元</i>
                    </span>
                  </div> -->
                </div>
              </div>
            </div>
          </div>
          <div class="weui-cell-foot">
            <van-button
              v-if="item.orderstatus === '学费'"
              type="info"
              @click="href('/CheckOrder', item.id)"
              round
              >查看订单</van-button
            >
            <van-button
              v-if="
                item.orderstatus !== '学费' &&
                  item.orderstatus == '科目一费用' &&
                  item.orderstatus == '基础费用'
              "
              type="info"
              @click="href('/OrdersDetails', item.id)"
              round
              >查看订单</van-button
            >

            <van-button
              v-if="
                item.orderstatus !== '学费' &&
                  item.orderstatus !== '科目一费用' &&
                  item.orderstatus !== '基础费用' &&
                  item.orderstatus !== '充值' &&
                  item.orderstatus !== '提现' &&
                  item.orderstatus != '提现' &&
                  item.orderstatus != '充值'
              "
              type="info"
              @click="href('/Evaluate', item.id)"
              round
              >评价</van-button
            >
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { userIndent } from "../../../assets/js/api/user";
import { baseURL } from "../../../assets/js/config";
export default {
  name: "Completed",
  data() {
    return {
      // 已完成
      completed: []
    };
  },
  mounted() {
    this.baseURL = baseURL;
    // 已完成
    let userId = 2;
    userIndent(userId).then(res => {
      this.completed = res.data;
      // console.log(this.completed);
    });
  },
  methods: {
    href(url, id) {
      this.$router.push({ path: url + "/" + id });
    }
  }
};
</script>

<style></style>
